package cn.tedu;

import java.util.Scanner;

/*正则表达式--身份证号*/
public class Zhengze {
    public static void main(String[] args) {
        String regex = "[0-9]{17}[0-9x]";
        String input;
        do{
            System.out.println("请输入身份证号:");
            input= new Scanner(System.in).nextLine();
            if(input.matches(regex)){
                System.out.println("恭喜您,输入正确");
                return;
            }
        }while(!input.matches(regex));
    }
}
